local Lua__zhumie = fk.CreateSkill {

  name = "Lua__zhumie",

}

Fk:loadTranslationTable{
    ["Lua__zhumie"] = "诛灭",
    ["$Lua__zhumie1"] = "痛苦圣经",
    [":Lua__zhumie"] = "一名其他角色的回合开始时，你可以移去任意枚痛苦，视为对其使用了等量张无限制且不计入次数的雷【杀】。",
    ["#zhumie-choice"] = "诛灭：选择要移去的“痛苦”标记数（对 %dest 使用等量张雷【杀】）",
}

Lua__zhumie:addEffect(fk.TurnStart, {
  name = "Lua__zhumie",
    anim_type = "offensive",
    events = {fk.TurnStart},
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(Lua__zhumie.name) and target ~= player and
               player:getMark("@tongku") > 0 and
               not player:isProhibited(target, Fk:cloneCard("thunder__slash"))
    end,
    on_cost = function(self, event, target, player, data)
        local room = player.room
        local choices = {}
        for i = 1, player:getMark("@tongku") do
          table.insert(choices, tostring(i))
        end
        table.insert(choices, "Cancel")
        local choice = player.room:askToChoice(player, {
            choices = choices,
            skill_name = Lua__zhumie.name,
            prompt = "#zhumie-choice::" .. target.id,
        })
        if choice ~= "Cancel" then
            event:setCostData(self, {choice = tonumber(choice)} )
            return true
        end
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        if (event:getCostData(self).choice or 0) > 0 then
            local discardNum = event:getCostData(self).choice
            room:removePlayerMark(player, "@tongku", discardNum)
        -- 使用雷杀
            for i = 1, discardNum do
                room:useVirtualCard("thunder__slash", nil, player, {target}, Lua__zhumie.name, true)
            end
        end
    end,
})

return Lua__zhumie